package data

import (
	"context"
	"digitalhuman/models"
)

type VideoRecordData struct {
	data        *Data
	sectionData *StoryboardSectionData
	AssetData   *AssetData
}

func (v *VideoRecordData) SendVideoReq(sectionId int64) {
	// 1.数据表查询
	ctx := context.Background()
	section, err := v.sectionData.FindByID(ctx, sectionId)
	if err != nil {
		return
	}
	arr := []int64{int64(section.HumanVmId), int64(section.BackgroundVmId)}
	// 查询数据表 visual_material
	var visualMaterial []*models.VisualMaterial
	result := v.data.Db.Where("id in （?）", arr).Find(visualMaterial)
	if result.Error != nil {
		return
	}
	reqData := make(map[string]interface{})
	humanAsset := v.AssetData.FindAssetFromAssetMap(section.HumanVmId)
	if humanAsset != nil {
		reqData["human_url"] = humanAsset.Thumbnail
	}
	backgroundAsset := v.AssetData.FindAssetFromAssetMap(section.BackgroundVmId)
	if backgroundAsset != nil {
		reqData["background_url"] = backgroundAsset.Thumbnail
	}

	// todo 发起请求
}

func NewVideoRecordData(data *Data, sectionData *StoryboardSectionData, assetData *AssetData) *VideoRecordData {
	return &VideoRecordData{
		data:        data,
		sectionData: sectionData,
	}
}
